<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<div id="log"></div>
<script>
test(() => {
    assert_selection(
        '<div contenteditable><a href="abc">^0123456789|</a></div>',
        'unlink',
        '<div contenteditable>^0123456789|</div>',
        'Fully Select A element');

    assert_selection(
        '<div contenteditable><a href="abc">012^345|6789</a></div>',
        'unlink',
        '<div contenteditable><a href="abc">012</a>^345|<a href="abc">6789</a></div>',
        'Partially Select A element');

    assert_selection(
        '<div contenteditable><a href="abc">0123456^789</a>xy|z</div>',
        'unlink',
        '<div contenteditable><a href=\"abc\">0123456</a>^789xy|z</div>',
        'Partially Select A element and following test');

    assert_selection(
        '<div contenteditable><a href="abc">^<img src="../resources/abe.png">|</a></div>',
        'unlink',
        '<div contenteditable>^<img src="../resources/abe.png">|</div>',
        'Select image in a link');

    assert_selection(
        '<div contenteditable>^<ul><li><a href="1">1</a></li><li><a href="2">2</a></li></ul>|</div>',
        'unlink',
        '<div contenteditable><ul><li>^1</li><li>2|</li></ul></div>',
        'Select a list');

    assert_selection(
        '<div contenteditable><table><tr><td><a href="1">^1</a></td><td><a href="2">2|</a></td></tr></table></div>',
        'unlink',
        '<div contenteditable><table><tbody><tr><td>^1</td><td>2|</td></tr></tbody></table></div>',
        'Select a table');
});
</script>
